# -*- coding:utf-8 -*-

from django.conf.urls import include, url
# from .apis import datakeeper_api
from .models import *
from warnings import warn


urlpatterns = []

mods = WrasModule.objects.filter(enabled=True)
for mod in mods:
    try:
        if mod.has_sub_url:
            urlpatterns.append(url('{}/'.format(mod.name), include('wrasmods.{}.urls'.format(mod.name))))
        urlpatterns.append(url(r'^(?P<modname>{})/(?P<resource>.*)'.format(mod.name), 'fengge.views.mod_resource_view', name="mod_resource_view"))
    except Exception as e:
        warn(repr(e))
